package com.example.xmhds_1.config;

import com.example.xmhds_1.service.UserAccountService;
import com.example.xmhds_1.ws.WebSocket;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.server.standard.ServerEndpointExporter;

/**
 * WebSocket配置类
 */
@Configuration
public class WebSocketConfig {

    @Autowired
    private UserAccountService userAccountService;

    @Bean
    public ServerEndpointExporter serverEndpointExporter() {
        WebSocket.setUserAccountService(userAccountService);
        return new ServerEndpointExporter();
    }
}
